import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'nav',
      redirect: '/home', 
      component: () => import('../views/NavView.vue'),
      children:[
        {
          path: '/home',
          name: 'home',
          component: HomeView,
          children:[
            {
              path:'',
              name: 'rated',
              component:()=>import('../page/Home-TopRatedMovie.vue')
            },
            {
              path:'cinemas',
              name:'cinemas',
              component:()=>import('../page/Home-Cinemas.vue')
            },
            {
              path:'expected',
              name:'expected',
              component:()=>import('../page/Home-Expected.vue')
            },
            {
              path:'classic',
              name:'classic',
              component:()=>import('../page/Home-Classic.vue')
            }
          ]
        },
        {
          path: '/movie',
          name: 'movie',
          component: () => import('../views/MovieView.vue')
        },
        {
          path: '/audio',
          name: 'audio',
          component: () => import('../views/AudioView.vue')
        },
        {
          path: '/play',
          name: 'play',
          component: () => import('../views/PlayView.vue')
        },
        {
          path: '/mine',
          name: 'mine',
          component: () => import('../views/MineView.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    },
    {
      path: '/play/search',
      name: 'playsearch',
      component: () => import('../views/PlaySearchView.vue')
    },
    {
      path: '/play/:pid',
      name: 'playDetail',
      props: true,
      component: () => import('../views/PlayDetailView.vue')
    },
    {
      path: '/play/:pid/:lat/:lng',
      name: 'playWay',
      props: true,
      component: () => import('../views/PlayWayView.vue')
    },
    {
      path: '/cinema/:id',
      name: 'cinemaDetail',
      component: () => import('../page/Cinema-Detail.vue')
    },
    {
      path: '/movie/:id',
      name: 'movieDetail',
      props: true,
      component: () => import('../views/MovieDetailView.vue')
    },
    {
      path: '/search',
      name: 'search',
      component: () => import('../views/SearchView.vue')
    },
    {
      path: '/position',
      name: 'position',
      component: () => import('../views/PositionView.vue')
    },
    {
      path: '/buy',
      name: 'buy',
      component: () => import('../views/BuyTicketView.vue')
    },
    {
      path: '/mine/want',
      name: 'want',
      component: () => import('../views/WantView.vue')
    },
    {
      path: '/mine/order',
      name: 'order',
      component: () => import('../views/OrderView.vue')
    },
  ]
})

export default router
